<#include "/admin/common/header.ftl">
<link href="/css/page/orderDetail.css" rel="stylesheet">
<body>
<div class="page-trade-order-detail with-padding">
<#if order.status!=11>
    <div class="step-region">
        <ul class="ui-step ui-step-4">
            <li class="ui-step-done">
                <div class="ui-step-title">买家下单</div>
                <div class="ui-step-number">1</div>
                <div class="ui-step-meta">${(order.createTime?datetime)!}</div>
            </li>
            <li <#if order.payTime??>class="ui-step-done"</#if>>
                <div class="ui-step-title">买家付款</div>
                <div class="ui-step-number">2</div>
                <div class="ui-step-meta">${(order.payTime?datetime)!}</div>
            </li>
            <li <#if order.deliveryTime??>class="ui-step-done"</#if>>
                <div class="ui-step-title">商家发货</div>
                <div class="ui-step-number">3</div>
                <div class="ui-step-meta">${(order.deliveryTime?datetime)!}</div>
            </li>
            <li <#if order.finishTime??>class="ui-step-done"</#if>>
                <div class="ui-step-title">交易完成</div>
                <div class="ui-step-number">4</div>
                <div class="ui-step-meta">${(order.finishTime?datetime)!}</div>
            </li>
        </ul>
    </div>
</#if>
    <div class="content-region clearfix">
        <div class="info-region"><h3>订单信息<span class="secured-title">担保交易</span></h3>
            <table class="info-table">
                <tbody>
                <tr>
                    <th>订单编号：</th>
                    <td>${order.orderNum!}</td>
                </tr>
                <tr>
                    <th>订单类型：</th>
                    <td>普通订单</td>
                </tr>
                <tr>
                    <th>付款方式：</th>
                    <td>${order.paymentMethod}</td>
                </tr>
                <tr>
                    <th>买家：</th>
                    <td><span>${order.memberName!}</span></td>
                </tr>
                </tbody>
            </table>
            <div class="dashed-line"></div>
            <table class="info-table">
                <tbody>
                <tr>
                    <th>配送方式：</th>
                    <td>商家配送</td>
                </tr>
                <tr>
                    <th>收货地址：</th>
                    <td>${order.address!}</td>
                </tr>
                <tr>
                    <th>收货人：</th>
                    <td>${order.consignee!}</td>
                </tr>
                <tr>
                    <th>联系电话：</th>
                    <td>${order.mobile!}</td>
                </tr>
                <tr>
                    <th>买家留言：</th>
                    <td>${order.markText!}</td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="state-region">
            <div class="state-action-region">
                <h3 class="state-title">
                    <i class="icon <#if order.status==10>icon-check success<#else>icon-info</#if>"></i>订单状态：${order.statusS}
                </h3>
			<#if historyList??>
                <div class="state-desc">${historyList[0].content}<span class="history-info">更多<i class="icon icon-double-angle-right"></i></span></div>
			</#if>
                <div class="state-action">
				<#if order.status<10>
                    <button class="btn btn-danger" onclick="closeOrder(${order.orderId})">关闭订单</button></#if>
				<#if order.status==3>
                    <button class="btn btn-primary" onclick="startDelivery(${order.orderId})">开始发货</button></#if>
				<#if order.status==4 && !order.isSign>
                    <button class="btn btn-warning" onclick="changeExpress(${order.orderId})">修改物流</button></#if>
                </div>
            </div>
            <div class="state-remind-region">
                <div class="dashed-line"></div>
                <div class="state-remind"><h4>友情提醒：</h4>
                    <ul>
                        <li>1.如果商家无法正常发货，请及时与买家联系并说明情况并及时退款；</li>
                        <li>2.买家付款后超过7天仍未发货，将有权申请客服介入发起退款维权；</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="order-comment"></div>
    <table class="ui-table ui-table-simple goods-table order-detail-goods-table">
        <thead>
        <tr>
            <th></th>
            <th class="cell-30">商品</th>
            <th>价格(元)</th>
            <th>数量</th>
            <th class="cell-20">小计(元)</th>
            <th>状态</th>
        </tr>
        </thead>
        <tbody>
		<#list orderItemList as orderItem>
        <tr class="test-item">
            <td class="td-goods-image">
                <div class="ui-centered-image" style="width: 48px; height: 48px;">
                    <img src="${orderItem.goodsImg!}?x-oss-process=image/resize,m_pad,h_60,w_60,limit_0" onerror="this.src='/image/no_pic.png'" style="max-width: 48px; max-height: 48px;">
                </div>
            </td>
            <td>
                <a href="${host!}/goods/${orderItem.goodsId!}?debug=true" target="_blank">${orderItem.goodsName!}</a>
            </td>
            <td>${orderItem.price?string.currency}</td>
            <td>${orderItem.productNum!}</td>
            <td>${orderItem.totalAmount?string.currency}</td>
            <td><span>${orderItem.statusS!}</span></td>
        </tr>
		</#list>
        </tbody>
        <tfoot>
        <tr>
            <td colspan="7" class="text-right">
                <span>总计：</span>
                <span class="real-pay c-red">${(order.totalAmount + order.postage)?string.currency}</span>
                <span>（含运费 ${order.postage?string.currency}）</span>
            </td>
        </tr>
        </tfoot>
    </table>
</div>
<#include "/admin/common/footer.ftl">
<script type="text/javascript">
    var dlg = new $.zui.ModalTrigger({
        backdrop: 'static'
    });

    function startDelivery(orderId) {
        dlg.show({remote: '/admin/order/deliveryForm?orderId=' + orderId});
    }

    function changeExpress(orderId) {
        dlg.show({remote: '/admin/order/deliveryForm?orderId=' + orderId});
    }

    function closeOrder(orderId) {
        bootbox.confirm({
            title: "操作提示",
            size: "small",
            message: "你确定要关闭该订单？",
            callback: function (result) {
                if (result) {
                    $.ajax({
                        type: 'post',
                        url: '/admin/order/closeOrder?orderId=' + orderId,
                        success: function (data) {
                            successTip(data);
                            setTimeout("location.reload()", 1000);
                        }
                    });
                }
            }
        })
    }

    $(".history-info").click(function () {
        dlg.show({remote: '/admin/order/orderHistoryForm?orderId=${order.orderId}'});
    })
</script>
</body>
</html>